package homework.day03;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * @Classname: HomeWork01
 * @Author: bromide
 * @CreateTime: 2022/4/2--9:39
 * @Version: V1.0
 * @Description: 向文件testpw.txt中以UTF-8编码写入一行字符串：
 * 你好!我喜欢java!
 */
public class HomeWork01 {
    public static void main(String[] args) throws FileNotFoundException {
        File file = new File("testpw.txt");
        FileOutputStream fos = new FileOutputStream(file);
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw, true);
        pw.println("你好！我喜欢java！");
        System.out.println("输出完毕！");
        pw.close();

    }
}
